package com.rc.scripting;

import javax.swing.SwingUtilities;

import com.rc.scripting.plugin.Plugin;
import com.rc.scripting.plugin.SimplePlugin;
import com.rc.scripting.plugin.SimplePluginManager;
import com.rc.scripting.ui.SalaryCalculator;

public class Tester {
	private SalaryCalculator calc;
	
	public Tester(SalaryCalculator calc){
		this.calc = calc;
	}
	
	/**
	 * load plugin, activate it, and install it to
	 * plugin-manager.
	 */
	public void init(){
		Plugin system = new SimplePlugin("scripts/calc.js");
		system.activate();
		SimplePluginManager.getInstance().install(system);
	}
	
	/**
	 * launch the UI component
	 */
	public void launch(){
		SwingUtilities.invokeLater(new Runnable(){
			public void run() {
				calc.showUp();
			}
		});
	}
	
	public static void main(String[] args){
		SalaryCalculator calc = new SalaryCalculator();
		Tester tester = new Tester(calc);
		tester.init();
		tester.launch();
	}
}
